#!/usr/bin/perl
use strict;
use warnings;
use Template;
use Cwd;
    
chdir("C:/carmd-cvs02/Koala");
my $dir=getcwd;
print "current work directory= $dir, \n\n";
    
my $value=$ARGV[0];
#    my $file = 'C:/carmd-cvs01/Data_Parser/DynamicWebPage/DynamicWebPage.html';
#    my $vars = {
#       message  => "Hello World\n"
#    };
    

# some useful options (see below for full list)
my $config = {
    INCLUDE_PATH => 'C:\carmd-cvs02\Koala\webpagetemplate',  # or list ref
    INTERPOLATE  => 1,               # expand "$var" in plain text
    POST_CHOMP   => 1,               # cleanup whitespace 
    PRE_PROCESS  => 'header',        # prefix each template
    EVAL_PERL    => 1,               # evaluate Perl code blocks
    
};

# create Template object
my $tt = Template->new($config);


# define template variables for replacement
my $vars = {
	    var1  => $value,
	#    var2  => \%hash,
	#    var3  => \@list,
	#    var4  => \&code,
	#    var5  => $object,
	};

# specify input filename, or file handle, text reference, etc.
# my $input = $dir."/webpagetemplate/example.tt";
my $input='datasummary.tt';
my $output="./html/example.html";

# process input template, substituting variables
$tt->process($input, $vars, $output)	|| die $tt->error();
    
print "The processing is done!\n";    
END;    

